<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script>

function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {alert(alerttxt);return false}
  else {return true}
  }
}
function validate_check(field, alerttxt) {
	var rx = new RegExp("[^0-9]+");
	with(field)
	{
		if (rx.test(value)) {
			alert(alerttxt);
			return false;
		}
		return true;
	}
}

function validate_form(thisform)
{
with (thisform)
  {
  if (validate_required(account,"账号不能为空")==false)
    { account.focus(); return false}
   if (validate_check(account, "账号不能含有符号")==false) {
	  return false
  }
   if (validate_required(password,"密码不能为空")==false)
  	{return false}
  }
}

</script>
<body>
	<form action="loginServlet" method="post" onsubmit="return validate_form(this)">
		账号:<input name="account" type="text"><br>
		密码:<input name="password" type="password"><br>
		类型:<input name="type" type="radio" value=1 checked>生产者&nbsp;&nbsp;
			 <input name="type" type="radio" value=2>加工者<br>
		<input name="submit" type="submit" value="提交">
		<input name="reset" type="reset" value="重置">
	</form>
</body>
</html>